package com.xl333.util;

import java.io.InputStream;
import java.util.Properties;

/**
 * @author 七月的狮子
 * @date 2020/5/25
 */
public class PropertiesUtil {

    private static Properties properties = new Properties();

    static{
        InputStream inputStream = null;
        try {
            String configFilePath = "resource/config.properties";
            inputStream = PropertiesUtil.class.getClassLoader().getResource(configFilePath).openStream();
            properties.load(inputStream);
        } catch (Exception e){
            e.printStackTrace();
        } finally {
            if(inputStream != null){
                try {
                    inputStream.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public static String getValue(String key){
        return properties.getProperty(key);
    }

}
